import {useRoutes} from 'react-router-dom';
import {Suspense} from 'react';

import routes from './router';

function App() {
	// 获取路由配置表
	const element = useRoutes(routes);
	return (
		<div style={{height:"100vh"}}>
			{/* 懒加载路由兜底方法 */}
			<Suspense
				fallback={
					<div
						style={{
							textAlign: 'center',
							marginTop: 200,
						}}>
						loading...
					</div>
				}>
				{/* 注册路由组件 */}
				{element}
			</Suspense>
		</div>
	);
}

export default App;
